<?php

namespace app\common;

require_once __DIR__.'/Base.php';
require_once __DIR__.'/TableTool.php';
require_once __DIR__.'/Validate.php';
require_once __DIR__.'/Common.php';
require_once __DIR__.'/RpcClient.php';
use app\common\Base;
use app\common\TableTool;
use app\common\Validate;
use app\common\Common;
use RpcClient;

/**
 * 基类控制器
 */
class Controller extends Base
{
    
    /**
     * 数据库
     */
    protected $table = null; 

    /**
     * 验证
     */
    protected $validate = null; 

    /**
     * 常用函数对象
     */
    protected $common = null;  


    public $db_sys = null;

    
    /**
     * 过滤掉，无需处理的消息接口
     */
    public $api_ignore_method_list = array();


    protected $admin_id = null;


    public function __construct()
    {
        parent::__construct();
        $this->table = new TableTool(); 
        $this->validate = new Validate();
        $this->common = new Common(); 
        $this->admin_id = isset($_SESSION['admin_id'])?$_SESSION['admin_id']:1;
        $this->rpc_config();
    }


    /**
     * 实例化rpc
     */
    public function rpc_instance($name='')
    {
        return RpcClient::instance($name);
    }
    

    /**
     * rpc配置
     */
    public function rpc_config()
    {
        $address_array = array(
              'tcp://192.168.101.201:2015',
              'tcp://192.168.101.201:2015'
              );
        RpcClient::config($address_array);
    }

}





